import React, { PropsWithChildren } from "react";
import ChangeBrowser from './ChangeBrowser';
import { isAllowBrowser, BrowsersType } from './util';

export interface ProBrowserCheckProps {
  allowBrowser?: BrowsersType
}

export const ProBrowserCheck: React.FC<PropsWithChildren<ProBrowserCheckProps>> = ({ children, allowBrowser }) => {
  const { isAllow } = isAllowBrowser(allowBrowser);

  return isAllow ? children : <ChangeBrowser />
};
